import request from '@/utils/request'
// 获取订单
// mode: cart    => obj { cartId }
// mode: buyNow  => obj { goodsId, goodNum, goodsSkuId }
export const getOrder = (mode, obj) => {
  return request.get('/checkout/order', {
    params: {
      mode,
      delivery: '10', // 10快递 20自提
      // shopId: 0, // 自提门店
      couponId: 0, // 优惠券
      isUsePoints: 0, // 积分
      ...obj
    }
  })
}

// 提交订单
export const submitOrder = (mode, params) => {
  return request.post('/checkout/submit', {
    mode,
    delivery: 10,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    ...params
  })
}

// // 订单列表
export const getMyOrderList = (dataType, page) => {
  return request.get('/order/list', {
    params: {
      dataType,
      page
    }
  })
}
